import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class IntimateListPage extends StatefulWidget {
  const IntimateListPage({super.key});

  @override
  State<IntimateListPage> createState() => _IntimateListPageState();
}

class _IntimateListPageState extends State<IntimateListPage> {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: const Color(0xFF271D51),
      child: Stack(
        children: [
          Image.asset('assets/app/images/user_center/lntimate_top_bg.png'),
          Scaffold(
            backgroundColor: Colors.transparent,
            appBar: BrnAppBar(
              title: '亲密榜单',
              backgroundColor: Colors.transparent,
              themeData: BrnAppBarConfig(
                  titleStyle: BrnTextStyle(color: Colors.white), actionsStyle: BrnTextStyle(color: Colors.white)),
            ),
            body: Container(
              child: Column(
                children: [
                  const SizedBox(height: 30),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: [
                      _buildBandWarpper(index: 2),
                      _buildBandWarpper(index: 1),
                      _buildBandWarpper(index: 3),
                    ],
                  ),
                  Expanded(
                    child: Container(
                      decoration: BoxDecoration(
                          color: const Color(0xFF120D25),
                          borderRadius:
                              BorderRadius.only(topLeft: Radius.circular(12.r), topRight: Radius.circular(12.r))),
                      child: ScrollConfiguration(
                          behavior: const ScrollBehavior(),
                          child: ListView.builder(
                            padding: const EdgeInsets.only(left: 12, right: 12, bottom: 30),
                            itemCount: 100,
                            itemBuilder: (context, int position) {
                              return Container(
                                alignment: Alignment.center,
                                padding: const EdgeInsets.symmetric(vertical: 10),
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                  children: [
                                    Row(
                                      children: [
                                        Text(position.toString(),
                                            style: const TextStyle(fontSize: 13, color: Colors.white)),
                                        const SizedBox(width: 10),
                                        Image.asset('assets/images/app_logo.png', width: 46),
                                        const SizedBox(width: 10),
                                        const Text('SHKUNL', style: TextStyle(fontSize: 13, color: Colors.white)),
                                        const SizedBox(width: 10),
                                        Image.asset('assets/app/images/world/user_sex_boy.png', width: 18),
                                      ],
                                    ),
                                    const Text('亲密值 14.1w', style: TextStyle(fontSize: 12, color: Colors.white)),
                                  ],
                                ),
                              );
                            },
                          )),
                    ),
                  )
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }

  Stack _buildBandWarpper({
    required int index,
  }) {
    return Stack(
      children: [
        Image.asset(
          'assets/app/images/user_center/lntimate_icon_$index.png',
          width: 96.w,
          height: index == 1 ? 247 : 208,
        ),
        Container(
          width: 96.w,
          alignment: Alignment.center,
          padding: const EdgeInsets.only(top: 30),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Stack(
                children: [
                  Padding(
                    padding: const EdgeInsets.only(right: 6.0, top: 10),
                    child: Image.asset('assets/app/images/message/coin_icon.png', width: 56),
                  ),
                  Positioned(
                      top: 0,
                      right: 0,
                      child: Image.asset('assets/app/images/user_center/lntimate_icon_huang_$index.png', width: 23)),
                  Positioned(
                      bottom: 0, right: 5, child: Image.asset('assets/app/images/world/user_sex_boy.png', width: 18)),
                ],
              ),
              const SizedBox(height: 10),
              Text('佐助', style: TextStyle(color: Colors.white, fontSize: 14.sp, fontWeight: FontWeight.w600)),
              const SizedBox(height: 10),
              Text.rich(TextSpan(style: TextStyle(fontSize: 13.sp, color: const Color(0xFF25D4D0)), children: [
                TextSpan(text: '亲密值  ', style: TextStyle(fontSize: 10.sp, color: Colors.white)),
                const TextSpan(text: '22.9w'),
              ])),
            ],
          ),
        ),
      ],
    );
  }
}
